/*
 * Project: SmartWard
 * Package: com.ruoyi.ichen.app.service
 * File: IProfileService
 * Date: 2020-2-17 16:52
 * Version: V1.0
 * Copyright © 2018 - 2019 YESOFT CHINA, Inc. All Rights Reserved.
 */
package com.ruoyi.ichen.app.service;

import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.ichen.base.service.BaseDBService;
import com.ruoyi.ichen.entity.IProfile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

/**
 * @ClassName: IProfileService
 * @Description: TODO(用一句话描述该类)
 * @Author chenhuanghua
 * @Date 2020-2-17 16:52
 * @Version V1.0
 */
@Service
public class IProfileService extends BaseDBService<IProfile> {

    /**
     * 上传保存
     * @param url
     * @param file
     */
    public void insertByUpload(String url, MultipartFile file){
        IProfile profile = new IProfile();
        profile.setName(file.getOriginalFilename());
        profile.setSuffix(FileUploadUtils.getExtension(file));
        profile.setUrl(url);
        profile.setCreateTime(new Date());
        this.insert(profile);
    }

}